﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.ComponentModel.DataAnnotations;

namespace Sausage.Web.Models
{
    /// <summary>
    /// 账户详细信息
    /// </summary>
    /// <remarks></remarks>
    public class AccountDetail : IValidatableObject
    {
        #region ---Property


        /// <summary>
        /// 获得或者设置用户编号。
        /// </summary>
        /// <value>用户编号。</value>
        /// <remarks></remarks>
        public Guid UserID
        {
            get;
            set;
        }

        /// <summary>
        /// 获得或设置用户所属角色。
        /// </summary>
        /// <value>用户所属角色。</value>
        /// <remarks></remarks>
        public Guid[] Roles
        {
            get;
            set;
        }

        /// <summary>
        /// 获得或者设置所属组织结构编号。
        /// </summary>
        /// <value>所属组织结构编号。</value>
        /// <remarks></remarks>
        [Display(Name = "所属单位")]
        [Required(ErrorMessageResourceType = typeof(Sausage.Web.Properties.Resources), ErrorMessageResourceName = "ERROR_REQUIRED_ORGANIZATION")]
        public Guid OrganizationID
        {
            get;
            set;
        }

        /// <summary>
        /// 获得或者设置用户名称。
        /// </summary>
        /// <value>用户名称。</value>
        /// <remarks></remarks>
        [Display(Name = "用户名")]
        [StringLength(40)]
        [Required(ErrorMessageResourceType = typeof(Sausage.Web.Properties.Resources), ErrorMessageResourceName = "ERROR_REQUIRED_USERNAME")]
        public string UserName
        {
            get;
            set;
        }

        /// <summary>
        /// 获得或者设置登录名称。
        /// </summary>
        /// <value>登录名称。</value>
        /// <remarks></remarks>
        [Display(Name = "登录名")]
        [StringLength(40)]
        [Required(ErrorMessageResourceType = typeof(Sausage.Web.Properties.Resources), ErrorMessageResourceName = "ERROR_REQUIRED_LOGINNAME")]
        public string LoginName
        {
            get;
            set;
        }

        /// <summary>
        /// 获得或者设置登录密码。
        /// </summary>
        /// <value>登录密码。</value>
        /// <remarks></remarks>
        [Display(Name = "登录密码")]
        [StringLength(40)]
        [Required(ErrorMessageResourceType = typeof(Sausage.Web.Properties.Resources), ErrorMessageResourceName = "ERROR_REQUIRED_PASSWORD")]
        public string Password
        {
            get;
            set;
        }

        /// <summary>
        /// 获得或者设置确认密码。
        /// </summary>
        /// <value>确认密码。</value>
        /// <remarks></remarks>
        [Display(Name = "确认密码")]
        [Required(ErrorMessageResourceType = typeof(Sausage.Web.Properties.Resources), ErrorMessageResourceName = "ERROR_REQUIRED_CONFIRMPASSWORD")]
        public string ConfirmPassword
        {
            get;
            set;
        }

        /// <summary>
        /// 获得或者设置是否可用。
        /// </summary>
        /// <value>是否可用。</value>
        /// <remarks></remarks>
        [Display(Name = "是否可用")]
        public bool IsEnabled
        {
            get;
            set;
        }

        /// <summary>
        /// 获得或者设置是否为内置账户。
        /// </summary>
        /// <value>是否为内置账户。</value>
        /// <remarks></remarks>
        [Display(Name = "内置账号")]
        public bool IsBuildin
        {
            get;
            set;
        }

        /// <summary>
        /// 获得或者设置备注信息。
        /// </summary>
        /// <value>备注信息。</value>
        /// <remarks></remarks>
        [Display(Name = "备注信息")]
        [StringLength(400)]
        public string Memo
        {
            get;
            set;
        }

        #endregion

        #region ---IValidatableObject

        /// <summary>
        /// 验证当前领域对象是否有效。
        /// </summary>
        /// <param name="validationContext">验证上下文。</param>
        /// <returns>包好验证失败信息的集合。</returns>
        /// <remarks></remarks>
        public IEnumerable<ValidationResult> Validate(ValidationContext validationContext)
        {
            return new List<ValidationResult>();
        }

        #endregion
    }
}